setWidth

abstract fun setWidth(block: DesignBlock, value: Float, maintainCrop: Boolean = false)

Update a block's width and optionally maintain the crop. If the crop is maintained, the crop values will be automatically adjusted. The content fill mode Cover is only kept if the features/transformEditsRetainCoverMode setting is enabled, otherwise it will change to Crop. If the size of a group is changed, both dimensions are modified and the aspect ratio of the group is kept. Required scope: "layer/resize"

Parameters

block

the block to update.

value

the new width of the block in its width mode, which getWidthMode returns. A SizeMode.ABSOLUTE value is in design units. A SizeMode.PERCENT value is a fraction of the width of the first parent that is not a group or a track.

maintainCrop

whether or not the crop values, if available, should be automatically adjusted. A SizeMode.PERCENT size and a PositionMode.PERCENT left or top keep their mode.